Flash-based caching implementations can handle all cached information in a uniform fashion. For example, frequently accessed or “hot” data can be cached to flash-based solid state drives (SSDs) or other similar devices, henceforth collectively referred to as cache devices. The corresponding cache is first made valid by reading the data blocks on the back-end disk (henceforth also referred to as virtual device or VD) and writing the target data to the cache device. Once the cache is valid, subsequent corresponding I/O reads are fetched from the cache device. In write-back (WB) mode, I/O writes are written only to the cache device and not to the VD. In write-through (WT) mode, I/O writes are written both to the cache device as well as the VD. In WB mode, whenever a cache window must be flushed (e.g., either during system recovery following a reboot, to free up active cache windows as part of least-recently-used (LRU) replacement, or to maintain a minimum number of free cache windows), the determination of which cache lines to flush is based on picking valid cache lines marked dirty. Usually, the flush can be done via background task. Once the flush is done successfully, the dirty bit for the corresponding cache lines is cleared (i.e., again becomes clean).
A standard caching approach can be generally characterized by a set of priority queues, a primarily LRU-based cache window promotion/demotion/replacement scheme, and data corresponding to the cache windows that are both read- and write-intensive. For example, priority queues from 1 to 16 (where 1 is the lowest priority and 16 the highest) can indicate less or more frequently accessed data. Generally, a caching algorithm can track hot data via a “heat” index: when a cached first block of hot data is no longer accessed as frequently compared to a second block of data (that may itself have become “hotter”), the heat index of the first block is reduced. Once the first block is sufficiently “cold” and there is not enough room for other data having a higher heat index, the cached first block is then replaced with “hotter” data from the second block.
Special in-band hints for file system I/O (generally indicating data priority or “heat”) can be supplied by interfacing with the file system layer and storing file system contextual information (generally consisting of file system metadata) as hints. When a file system I/O is received it is then checked for associated file system hints. Such “hinted” I/Os can be given higher or lower priority for I/O processing and therefore marked as “hot” data for caching (or as “cold” data not to be cached). It may be desirable to specify hints for I/O processing in an out of band fashion independently of the normal I/O stream.